Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v8 #110

Merged
merged 1 commit into from
Jul 25, 2019
Merged

v8 #110

merged 1 commit into from
Jul 25, 2019

Conversation

doug-martin
Copy link
Owner

A major change the the API was made in v8 to seperate concerns between the different SQL statement types.

Why the change?

  1. There were feature requests that could not be cleanly implemented with everything in a single dataset.
  2. Too much functionality was encapsulated in a single datastructure.
    • It was unclear what methods could be used for each SQL statement type.
    • Changing a feature for one statement type had the possiblity of breaking another statement type.
    • Test coverage was decent but was almost solely concerned about SELECT statements, breaking them up allowed for focused testing on each statement type.
    • Most the SQL generation methods (ToInsertSQL, ToUpdateSQL etc.) took arguments which lead to an ugly API that was not uniform for each statement type, and proved to be inflexible.

What Changed

There are now five dataset types, SelectDataset, InsertDataset, UpdateDataset, DeleteDataset and TruncateDataset

Each dataset type has its own entry point.

  • goqu.From, Database#From, DialectWrapper#From - Create SELECT
  • goqu.Insert, Database#Insert, DialectWrapper#Insert - Create INSERT
  • goqu.Update, Database#db.Update, DialectWrapper#Update - Create UPDATE
  • goqu.Delete, Database#Delete, DialectWrapper#Delete - Create DELETE
  • goqu.Truncate, Database#Truncate, DialectWrapper#Truncate - Create TRUNCATE

ToInsertSQL, ToUpdateSQL, ToDeleteSQL, and ToTruncateSQL (and variations of them) methods have been removed from the SelectDataset. Instead use the ToSQL methods on each dataset type.

Each dataset type will have an Executor and ToSQL method so a common interface can be created for each type.

@doug-martin doug-martin force-pushed the v8-rc branch 7 times, most recently from 1d86982 to a868d1f Compare July 24, 2019 15:39
Repository owner deleted a comment from codecov bot Jul 24, 2019
Repository owner deleted a comment from codecov bot Jul 24, 2019
@codecov

This comment has been minimized.

A major change the the API was made in `v8` to seperate concerns between the different SQL statement types.

**Why the change?**

1. There were feature requests that could not be cleanly implemented with everything in a single dataset.
2. Too much functionality was encapsulated in a single datastructure.
    * It was unclear what methods could be used for each SQL statement type.
    * Changing a feature for one statement type had the possiblity of breaking another statement type.
    * Test coverage was decent but was almost solely concerned about SELECT statements, breaking them up allowed for focused testing on each statement type.
    * Most the SQL generation methods (`ToInsertSQL`, `ToUpdateSQL` etc.) took arguments which lead to an ugly API that was not uniform for each statement type, and proved to be inflexible.

**What Changed**

There are now five dataset types, `SelectDataset`, `InsertDataset`, `UpdateDataset`, `DeleteDataset` and `TruncateDataset`

Each dataset type has its own entry point.

* `goqu.From`, `Database#From`, `DialectWrapper#From` - Create SELECT
* `goqu.Insert`, `Database#Insert`, `DialectWrapper#Insert` - Create INSERT
* `goqu.Update`, `Database#db.Update`, `DialectWrapper#Update` - Create UPDATE
* `goqu.Delete`, `Database#Delete`, `DialectWrapper#Delete` - Create DELETE
* `goqu.Truncate`, `Database#Truncate`, `DialectWrapper#Truncate` - Create TRUNCATE

`ToInsertSQL`, `ToUpdateSQL`, `ToDeleteSQL`, and `ToTruncateSQL` (and variations of them) methods have been removed from the `SelectDataset`. Instead use the `ToSQL` methods on each dataset type.

Each dataset type will have an `Executor` and `ToSQL` method so a common interface can be created for each type.

# Conflicts:
#	HISTORY.md
#	sql_dialect_test.go
@doug-martin doug-martin merged commit f38b0e2 into master Jul 25, 2019
@doug-martin doug-martin deleted the v8-rc branch October 16, 2021 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant